#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  int x;
  char y;
  cin>>x>>y;
  int c=x<=1000?8:8+ceil((x-1000)/500.0)*4;
  cout<<c+(y=='y'?5:0);
}